package org.sunrise.game.game.human;

import org.sunrise.game.common.db.entity.EntityHumanList;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue;

public class HumanObjectManger {
    // humanId-玩家对象
    private static final Map<String, HumanObject> humanObjects = new HashMap<>();
    // connectId-连接对象
    private static final Map<Long, ConnectObject> connectObjects = new HashMap<>();
    // connectId-humanId
    public static final Map<Long, String> humanIds = new HashMap<>();
    // uid-accountId
    public static final Map<String, Long> uidAccounts = new HashMap<>();
    // uid-roleList
    public static final Map<String, List<EntityHumanList>> uidPlays = new HashMap<>();
    // rpc回调队列
    public static ConcurrentLinkedQueue<Object> callBackQueue = new ConcurrentLinkedQueue<>();

    public static HumanObject getHumanObject(String id) {
        return humanObjects.get(id);
    }

    public static Collection<HumanObject> getHumanObjects() {
        return humanObjects.values();
    }

    public static void removeHumanObject(String id) {
        humanObjects.remove(id);
    }

    public static void addHumanObject(String id, HumanObject humanObject) {
        humanObjects.put(id, humanObject);
    }

    public static ConnectObject getConnectObject(long id) {
        return connectObjects.get(id);
    }

    public static void removeConnectObject(long id) {
        connectObjects.remove(id);
    }

    public static void addConnectObject(long id, ConnectObject connectObject) {
        connectObjects.put(id, connectObject);
    }
}